package com.neofinance.reactdemo;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.Selector;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by Michael Chen on 2017-8-22.
 */

@Endpoint(id = "customPoint")
@Component
public class CustomEndPoint {

    @ReadOperation
    public ApiResponse<Event> getCustom(@Selector String message) {
        return new ApiResponse<Event>("/customPoint/{message}", ApiResponse.CODE.SUCCESS, "获取Event结果", new Event(1, new Date(), message));
    }

    @ReadOperation
    public ApiResponse<String> getPointMap() {
        return new ApiResponse<String>("/customPoint", ApiResponse.CODE.SUCCESS, "获取Event结果", "Actuator Endpoint from Spring Boot 2.0.0.BUILD-SNAPSHOT, Do you Like it?");
    }

}
